<?php

namespace Filesystem;

class PathReference {
	private $base, $cwd;
	private $root, $tmp, $cache;
	private $download;
	private $logger;

	/// ..., $root, $tmp, $cache, $download
	public function __construct ($base, $cwd) {
		if (is_null($base) || $base{0} !== '/')
			throw '$base has to be an absolute path';
		if (is_null($cwd) || $cwd{0} !== '/')
			throw '$cwd has to be an absolute path';

		$this->base = $base;
		$argc = func_num_args();
		
		$formals = 2;
		$i = 0;
		$this->root = $argc > $formals + $i? func_get_arg($formals + $i++) : $base.'/root';
		$this->tmp = $argc > $formals + $i? func_get_arg($formals + $i++) : $base.'/tmp';
		$this->cache = $argc > $formals + $i? func_get_arg($formals + $i++) : $base.'/cache';
		//
		$this->download = $argc > $formals + $i? func_get_arg($formals + $i++) : "$this->cache/download";
	}

	public function getCache () {
		return $this->cache;
	}

	public function getDownload () {
		return $this->download;
	}
};
